package pl.surecase.eu;

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

public class MyDaoGenerator {
// 说明文档   http://www.360doc.com/content/14/0513/14/3639038_377234431.shtml

    public static void main(String args[]) throws Exception {
        String packName = "com.pachong.frameworkdemo.message.dao";
        String outDir = args[0];
        int version = 1;
        Schema schema = new Schema(version, packName);

        initMessageTable(schema);
        new DaoGenerator().generateAll(schema, outDir);
    }

    private static void initUserBean(Schema schema) {
        Entity userBean = schema.addEntity("UserBean");
        userBean.setTableName("user");
        userBean.addStringProperty("id").primaryKey().index();
        userBean.addStringProperty("phone");
        userBean.addStringProperty("profile_picture");
        userBean.addStringProperty("client_id");
        userBean.addStringProperty("name");
        userBean.addStringProperty("location");
        userBean.addStringProperty("gender");

    }



    private static void initMessageTable(Schema schema) {
        Entity messageTable = schema.addEntity("Message");
//        userBean.addStringProperty("id").primaryKey().index();
        messageTable.addIdProperty();
        messageTable.addStringProperty("icon");
        messageTable.addStringProperty("title");
        messageTable.addStringProperty("content");
        messageTable.addStringProperty("target_url");
        messageTable.addBooleanProperty("deletable");
        messageTable.addStringProperty("type");
        messageTable.addStringProperty("date");

    }
}
